The present invention relates to an information processing device, an information processing method, and a computer program, in which data is written to a memory. More particularly, the present invention relates to an information processing device, an information processing method, and a computer program, in which data is written to a memory for writing the data after erasing the data.
Further, the present invention relates to an information processing device, an information processing method, and a computer program, in which a valid page is restored without corruption at the next start time, even when power is shut-off during erasing and writing data to the page in a memory. More particularly, the present invention relates to an information processing device, an information processing method, and a computer program to preferably prevent the corruption of data in a page which is unstable due to the shut-off operation of power during erasing and writing the data in the page, even when power is shut-off again during writing the data to the page.
A non-contact and close communication system, typically, an IC card is widely spread because it is easy in the operation. For example, the IC card stores personal identification code, another personal identification (ID) information, valid information such as electronic ticket, and the like, thereby authenticating a visitor and a passenger at a cash dispenser, an entrance of a concert hole, or a ticket gate of a station.
The above-mentioned radio communication is generally based on the principle of electromagnetic induction. That is, the structure in this case includes an IC card having a memory function and a card reader/writer for writing/reading data to/from the memory in the IC card to access the data and forms one transformer serving as one system having a loop coil serving as a primary coil on the IC card side and an antenna serving as a secondary coil on the card reader/writer side. Further, the card reader/writer sends power and information to the IC card, similarly with the operation of electromagnetic induction, and the IC card is driven by the supplied power to send a response to a query signal from the card reader/writer. Therefore, the IC card itself does not need any driving power supplies such as a battery.
In the general use of IC card, a user passes the IC card through the card reader/writer. The card reader/writer always poles the IC card and then finds an external IC card, thereby starting the communication between the IC card of the card reader/writer and the external IC card.
Recently, another IC card having a memory of a relatively large capacity appears in association with the improvement of miniaturization technology. In the IC card with the large-capacity memory, a file system is developed on a memory space and a plurality of application is simultaneously stored, thereby using one IC card for a plurality of application. For example, the one IC card stores the plurality of application such as electronic money for electronic payment and electronic ticket for entrance to a specific concert hole. Here, the electronic money or electronic ticket means a system for electronic payment via electronic data issued in accordance with a fund provided by the user or the above-mentioned electronic data.
Basically, the IC card does not provide the driving power supply such as a battery as mentioned above. Therefore, a non-volatile memory, e.g., an EEPROM (Electrically Erasable & Programmable ROM) is used as the memory to continuously keep data even without any power.
When the IC card is apart from the card reader/writer or electromagnetic waves are not received due to another reason in the use of IC card, the driving power is not sufficiently supplied. For example, the power is shut-off during writing the data to the memory in the IC card, the writing operation normally does not end. As a consequence, data block the process of writing operation is unstable and, when the power is shut-off again, the data in the data block is corrupted.
In order to solve the data corruption due to the shut-off operation of power, additional data may be written to a data block except for the block which stores the previously-written data. In this case, since the writing operation of additional data does not corrupt the previously-written data, the unavailable status of IC card is prevented in the worst case.
In the case of updating data stored in a block B1 in a memory (rewriting the data stored in the block B1 to another data), additional data is written to the block B1 (overwritten to the already-stored data), the additional data is not completely written when the power supplied to the IC card is not sufficient during writing the data. Further, the data stored in the block B1 is corrupted. For example, the IC card is not available when the data stored in the block B1 indicates the money left of electronic money and additional data indicating the remaining money upon subtracting the price of additional shopping.
Then, the additional data to be written to the block B1 is written to another block B2 different from the block B1. In this case, the data in the memory is corrupted during writing the additional data in the block B2, the additional data is not completely written. Although the complete writing operation is not effective, at least the corruption of data stored in the block B1 is prevented. Finally, after ending the writing operation to the block B2, the data stored in the block B1 is erased. Further, another addition data is supplied and then it is written to a block (e.g., block B1) different from the block B2.
In addition to the data area for storing data to be stored, the memory space in the IC card has a management table which manages the physical arrangement of data blocks forming the data area. Here, the management table corresponds to an FAT (File Allocation Table) which manages the physical arrangement of data (e.g., sectors) based on the unit on a file space in a file system of MS-DOS (Microsoft-Disk Operating System (registered trademark)) widely-known in the computer field. In the specification, the management table in the non-volatile memory is also referred to as “root table”. Both the shut-off operation of power during writing the data to the IC card and the data corruption affect the serious influence on the root table as well as the data area.
The power is shut-off during writing the data to the page in the root table, the page is unstable, the data is corrupted, and then arrangement information is lost. Therefore, the data area is not accessed. In other words, although the data corruption in the root table does not results in the data corruption in the data area, the IC card is not available.
In the case of a memory device which performs the writing operation without any operation and a bit, not serving as a writing target, does not become zero even upon shutting-off the power during the writing operation, the above-mentioned problem of data corruption is not caused. That is, upon rewriting the data to the unstable page which is not normally written, the power is shut-off again and then the data is not corrupted.
However, in many recent non-volatile memories, the page is necessarily erased once and is written for update. In this case, upon rewriting the unstable page which is not normally written, the power is shut-off again and then the data in the page is corrupted.
To solve unexpected shut-off operation of power in the erasing and writing operation, the root table comprises two pages serving as a pair and the two pages are alternately used as a valid page and an invalid page to secure the data. See, Japanese Unexamined Patent Application Publication No. 11-25003.
Hereinbelow, a description is given of the principle of data erasing and writing operation in the root table comprising the two pages with reference to FIGS. 10A to 10C. Incidentally, the root table shown in FIGS. 10A to 10C comprises two pages A and B serving as a pair.
Referring to FIG. 10A, the data has already been stored in the page A serving as one page of the root table, and the data is erased on the page B serving as the other page.
In the case of writing additional data, referring to FIG. 10B, the additional data is written to the page B which does not record any data so as to prevent the corruption of previously-written data. After ending the data writing operation, referring to FIG. 10C, the entire data recorded to the page A is erased.
However, in the case of the root table comprising the two pages, the power is shut-off during the writing operation upon rewriting the data to the unstable page, the data in the unstable page might be corrupted.
In the middle of FIGS. 10A and 10B, the data in the page becomes stable during writing the data to the page B (refer to FIG. 11). The power is shut-off at this step and then it is not specified even by later referring to the data storage contents or status to the pages A and B, at which step during erasing or writing the data to the page B the writing operation stops. Therefore, the best recovery is determined.
Further, in the middle of FIGS. 10B and 10A, the data in the page becomes unstable during erasing the data to the page A (refer to FIG. 12). The power is shut-off at this step and then it is not specified even by later referring to the data storage contents or status to the pages A and B, at which step during erasing or writing the data to the page A the writing operation stops. Therefore, the best recovery is determined.
For example, in the root table including the two pages as a pair, any of the pages has a priority to limit the recovery. The page A has a priority and the data in the page A is copied to the page B for recovery. However, when the page A is unstable in this case, the data both on the pages A and B might be unstable.
The data corruption due to the unexpected shut-off operation of power during erasing/writing the data is not limited to the non-contact communication device such as the IC card. The same problem exists in a mobile phone or another information device having the erasable non-volatile memory when the external shock comes during erasing/writing the data and a battery serving as a main power supply is unexpectedly detached, or when a memory cartridge is detached from the device main body during erasing/writing the data.